<?php
// global $current_single_idx;

// Limit posts displayed for front-page
add_filter( 'post_limits', 'singcrets_post_limits' );

// Include slider js to header
add_action('wp_enqueue_scripts', 'singcrets_scripts_method');

function singcrets_post_limits( $limit ) {
    if ( is_front_page() ) {
        return 'LIMIT 0, 5';
    }
    return $limit;
}


function singcrets_scripts_method() {

	if(is_single()){
		wp_enqueue_script(
			'slides-script',
			get_bloginfo('stylesheet_directory'). '/js/slides.min.jquery.js',
			array('jquery')
		);
	}
	
	if(is_front_page()){
		wp_enqueue_script(
			'roundabout-script',
			get_bloginfo('stylesheet_directory'). '/js/jquery.roundabout.min.js',
			array('jquery')
		);
	}
	if(!is_admin()) {
		wp_enqueue_script(
			'custom-script',
			get_bloginfo('stylesheet_directory'). '/js/custom-scripts.js',
			array('jquery')
		);
	}
	js_localize('singcrets_global_vars', array('siteurl' => get_bloginfo('siteurl')));
	
	}
	/*
	
	wp_localize_script( 'global_variable_script', 'singcrets_global_variable', array('site_url' => get_bloginfo('stylesheet_directory')));
	
	wp_enqueue_script('global_variable_script');
	*/

	

// Regist Footer Menu Container
register_nav_menu( 'secondary', 'Footer Menu' );

// Regist Sidebar on Single Page
register_sidebar( array(
    'id'          => 'sidebar-single',
    'name'        => __( 'Singles Page Sidebar'),
	'before_widget' => '<aside id="%1$s" class="widget %2$s">',
	'after_widget' => "</aside>\n",
	'before_title' => '<h3 class="widget-title">',
	'after_title' => "</h3>\n"
) );

/* Regist Options Panel */
if(function_exists('synved_option_register')) {
	/* Singcrets Option List */
	$singcrets_options = array(
		'facebook_url' => array(
			'type' => 'text', 
			'label' => __('Facebook Link', 'singcrets_options')
		),
		'twitter_url' => array(
			'type' => 'text', 
			'label' => __('Twitter Link', 'singcrets_options')
		)
	);

	synved_option_register('singcrets_options', $singcrets_options);
}

